﻿@inherits ButtonParameters
@namespace BlazorFluentUI
@using Microsoft.AspNetCore.Components.Web

@if (ChildContent == null)
{
    if (MenuItemTemplate == null)
    {
        <ButtonBase Href=@Href
                    ClassName=@ClassName
                    Style=@Style
                    Primary=@false
                    Disabled=@Disabled
                    AllowDisabledFocus=@AllowDisabledFocus
                    PrimaryDisabled=@PrimaryDisabled
                    Checked=@Checked
                    AriaDescripton=@AriaDescripton
                    AriaLabel=@AriaLabel
                    AriaRoleDescription=@AriaRoleDescription
                    SplitButtonAriaLabel=@SplitButtonAriaLabel
                    Text=@Text
                    SecondaryText=@SecondaryText
                    Toggle=@Toggle
                    Split=@Split
                    IconName=@IconName
                    IconSrc=@IconSrc
                    HideChevron=@HideChevron
                    MenuItems=@MenuItems
                    SubordinateItemTemplate=@SubordinateItemTemplate
                    CheckedChanged=@CheckedChanged
                    OnClick=@OnClick
                    OnKeyDown=@OnKeyDown
                    Command=@Command
                    CommandParameter=@CommandParameter
                    AdditionalAttributes=@AdditionalAttributes
                    IsRadioButton=@IsRadioButton
                    GroupName=@GroupName
                    @ref="baseReference" />
    }
    else
    {
        <ButtonBase Href=@Href
                    ClassName=@ClassName
                    Style=@Style
                    Primary=@false
                    Disabled=@Disabled
                    AllowDisabledFocus=@AllowDisabledFocus
                    PrimaryDisabled=@PrimaryDisabled
                    Checked=@Checked
                    AriaDescripton=@AriaDescripton
                    AriaLabel=@AriaLabel
                    AriaRoleDescription=@AriaRoleDescription
                    SplitButtonAriaLabel=@SplitButtonAriaLabel
                    Text=@Text
                    SecondaryText=@SecondaryText
                    Toggle=@Toggle
                    Split=@Split
                    IconName=@IconName
                    IconSrc=@IconSrc
                    HideChevron=@HideChevron
                    MenuItems=@MenuItems
                    MenuItemTemplate=@MenuItemTemplate
                    SubordinateItemTemplate=@SubordinateItemTemplate
                    CheckedChanged=@CheckedChanged
                    OnClick=@OnClick
                    OnKeyDown=@OnKeyDown
                    Command=@Command
                    CommandParameter=@CommandParameter
                    AdditionalAttributes=@AdditionalAttributes
                    IsRadioButton=@IsRadioButton
                    GroupName=@GroupName
                    @ref="baseReference" />
    }
}
else
{
    if (MenuItemTemplate == null)
    {
        <ButtonBase Href=@Href
                    ClassName=@ClassName
                    Style=@Style
                    Primary=@false
                    Disabled=@Disabled
                    AllowDisabledFocus=@AllowDisabledFocus
                    PrimaryDisabled=@PrimaryDisabled
                    Checked=@Checked
                    AriaDescripton=@AriaDescripton
                    AriaLabel=@AriaLabel
                    AriaRoleDescription=@AriaRoleDescription
                    SplitButtonAriaLabel=@SplitButtonAriaLabel
                    Text=@Text
                    ContentTemplate=@ChildContent
                    SecondaryText=@SecondaryText
                    Toggle=@Toggle
                    Split=@Split
                    IconName=@IconName
                    IconSrc=@IconSrc
                    HideChevron=@HideChevron
                    MenuItems=@MenuItems
                    SubordinateItemTemplate=@SubordinateItemTemplate
                    CheckedChanged=@CheckedChanged
                    OnClick=@OnClick
                    OnKeyDown=@OnKeyDown
                    Command=@Command
                    CommandParameter=@CommandParameter
                    AdditionalAttributes=@AdditionalAttributes
                    IsRadioButton=@IsRadioButton
                    GroupName=@GroupName
                    @ref="baseReference" />
    }
    else
    {
        <ButtonBase Href=@Href
                    ClassName=@ClassName
                    Style=@Style
                    Primary=@false
                    Disabled=@Disabled
                    AllowDisabledFocus=@AllowDisabledFocus
                    PrimaryDisabled=@PrimaryDisabled
                    Checked=@Checked
                    AriaDescripton=@AriaDescripton
                    AriaLabel=@AriaLabel
                    AriaRoleDescription=@AriaRoleDescription
                    SplitButtonAriaLabel=@SplitButtonAriaLabel
                    Text=@Text
                    ContentTemplate=@ChildContent
                    SecondaryText=@SecondaryText
                    Toggle=@Toggle
                    Split=@Split
                    IconName=@IconName
                    IconSrc=@IconSrc
                    HideChevron=@HideChevron
                    MenuItems=@MenuItems
                    MenuItemTemplate=@MenuItemTemplate
                    SubordinateItemTemplate=@SubordinateItemTemplate
                    CheckedChanged=@CheckedChanged
                    OnClick=@OnClick
                    OnKeyDown=@OnKeyDown
                    Command=@Command
                    CommandParameter=@CommandParameter
                    AdditionalAttributes=@AdditionalAttributes
                    IsRadioButton=@IsRadioButton
                    GroupName=@GroupName
                    @ref="baseReference" />
    }
}

@code{
    private ButtonBase baseReference = new ButtonBase();
    protected override void OnAfterRender(bool firstRender)
    {
        RootElementReference = baseReference.RootElementReference;
        base.OnAfterRender(firstRender);
    }
}